<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>生产者</title>
		<script src="../js/mui.min.js"></script>
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/style.css" />
		<link rel="stylesheet" href="../css/iconfont.css" />
		<link rel="stylesheet" href="../css/index.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title" id='tou'>农机资源</h1>
			<!--<a class="mui-icon iconfont icon-sousuo-sousuo mui-pull-right search"></a>-->
			<a class="mui-icon mui-icon-search mui-pull-right search"></a>
		</header>
			<div id="demo" style="height:60px;">
				ddd
			</div>
			<div class="mui-input-row" style="width:100%;background-color: white;text-align: center;">
				<select id="select_k1" style="float: left; width: 48%;">
				<option value="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;农机类型</option>
				<select>
				<select name="select1" id="select_k2" style="float: right;width: 48%;">
				<option value="0"></option>
				<select>
					<div style="margin-top: 55px;" id="content">
					</div>
					
					
			</div>

				

		</div>
		<div id="footer"></div>
	</body>

</html>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/app.js" type="text/javascript"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=grTHl4v1H6uGFLChfz0aB0uQG4XWQv0k"></script>
<script type="text/javascript" src="../js/castapp.js"></script>
<script type="text/javascript" src="../js/layer/layer.min.js"></script>

<script>
getFoot(getUrlParam("foot_active") > 0 ? getUrlParam("foot_active") : 1);
	$(function() {
				$.ajax({
			//请求的url
			//注意，如果我们使用路由器的情况下，我们需要设置一下本地服务器的ip地址
			url: APP.api_url + 'Nj/fenl',
			data: {},
			dataType: 'JSONP', // 处理Ajax跨域问题
			//成功了的回调，并且带有返回值
			success: function(data) {
				if(data.code==200){
					var type=data.data;
			for(var i = 0; i < type.length; i++) {
								$('#select_k1').append('<option value=' + type[i]['id'] + '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' + type[i]['nj_type'] + '</option>');
			}		
				}
			}
		});
		type="";
		func1(type);
	});
	
function func1(type){
	
	
	$.ajax({
			//请求的url
			//注意，如果我们使用路由器的情况下，我们需要设置一下本地服务器的ip地址
			url: APP.api_url + 'Nj/njl',
			data: {
				type:type
			},
			dataType: 'JSONP', // 处理Ajax跨域问题
			//成功了的回调，并且带有返回值
			success: function(data) {
				if(data.code==200){
					var json = data.data;
				var goods_htm = '';
				if(json.length!=0){
				for(var i = 0; i < json.length; i++) {
					var strs = json[i]['img'].split("@"); //获取首图 		
					goods_htm += '<a href="nj_xq.html?nj_id=' + json[i].id + '" ><div class="mui-card-header mui-card-media">' +
						'<img src="' + APP.pic_url + strs[0] + '" />' +
						'<div class="mui-media-body" style="width:50%;">' + json[i].title + '<p>联系人 ' + json[i].contacts + '</p></div></div></a>';
				}
				goods_htm += '<div style="height:60px;width: 100%;float:left;"></div>';								
				}else{
					goods_htm='<img src="../images/qq.png" />';
					}
					document.getElementById('content').innerHTML=goods_htm;
				}
			}
		});
	
	
	
}
$("#select_k1").change(function(){
  var id=document.getElementById('select_k1').value;
  func1(id);
});

</script>